package com.childguo.webResult;

import lombok.Data;

@Data
public class Result<T> {
    private String  code;
    private String message;
    private T data;
    private final static String success_code = "200";
    private final static String fail_code = "400";

    public Result(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public Result(String message, T data) {
        this.message = message;
        this.data = data;
    }

    public  static <T> Result<T> success(String message, T data){
        return new Result<>(success_code, message, data);
    }

    public  static <T> Result<T> fail(String message, T data){
        return new Result<>(fail_code, message, data);
    }
}
